package com.chucang.shucang.sms.scheduled;

import com.chucang.shucang.sms.service.PanicPurchaseService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.klock.annotation.Klock;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author flitsneak
 * @email flitsneak@gmail.com
 * @date 2022/10/7 21:30
 * @description
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class PanicPurchaseScheduled {

    private final PanicPurchaseService panicPurchaseService;

    /**
     * 商品预热处理
     */
    //0 */1 * * * ?
    //0 0 3 * * ?
    @Klock(name = "pre:sale:product")
    @Scheduled(cron = "0 0 3 * * ?")
    public void productsOnShelves() {
        panicPurchaseService.onShelveProducts();
    }
}
